package com.flash.BusinessParameters.mapper;

import com.flash.BusinessParameters.entity.FundSetting;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;


@Repository
@Mapper
public interface FundSettingMapper {
    //删除
    @Delete("delete from fund where fundId=#{fundId}")
    public int deleteFundSetting(int fundId);
    /**
     * 按条件查询加分页
     * @param map 查询的参数
     * @return 用户的集合
     */
    @Select("select * from (select rownum rn,f.* from fund f) where 1=1 ${strWhere} and rn between #{page} and #{limit}")
    public List<FundSetting> selectFundSettingMap(Map map);

    //查询全部
    @Select("select * from fund")
    public List<FundSetting> selectFundSetting();
    //修改
    @Update("update fund set fundName=#{fundName},fundType=#{fundType},fundScale=#{fundScale},trustee=#{trustee},custodian=#{custodian}," +
            "fundNetWorth=#{fundNetWorth},trusteeCostRate=#{trusteeCostRate},custodianCostRate=#{custodianCostRate},foundTime=#{foundTime},cashId=#{cashId} where fundId=#{fundId}")
    public int updateFundSetting(FundSetting fundSetting);
    //添加
    @Insert("insert into fund values(#{fundId},#{fundName},#{fundType},#{fundScale},#{trustee},#{custodian},#{fundNetWorth},#{trusteeCostRate},#{custodianCostRate},#{foundTime},#{cashId})")
    public int insertFundSetting(FundSetting fundSetting);
    //查询有多少条
    @Select("select count(*) from fund")
    public int selectCountFundSetting();

}
